]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
mixer-control: Reset `stream-id`s on UI devices
authorGuido Günther <agx@sigxcpu.org>
Sun, 4 Jan 2026 12:07:31 +0000 (13:07 +0100)
committerSimon McVittie <smcv@debian.org>
Wed, 28 Jan 2026 13:25:18 +0000 (13:25 +0000)
If we find a matching UI device for a stream matching card and
port and the same stream is also on another port, reset that
UI devices `stream-id`.

Since wireplumber 1.5.84 will merely flip the port but not the
`stream-id` we need to make sure the UI device loses its stream-id.
Otherwise `gvc_mixer_control_change_output` will try a
`gvc_mixer_stream_change_port` which seemingly succeeds but fails
silently as the port doesn't exist on that stream at the moment.

By resetting the `stream-id` we ensure that we take the
`gvc_mixer_control_change_profile_on_selected_device` code path in
`gvc_mixer_control_change_output` instead and thus the sink/port
gets properly selected.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Origin: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/merge_requests/31
Bug: https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/issues/34
Bug-Debian: https://bugs.debian.org/1126514
Applied-upstream: gnome-shell 50, commit:798230599950607ec285daecd070f5bcb28580e4

Gbp-Pq: Topic libgvc
Gbp-Pq: Name mixer-control-Reset-stream-id-s-on-UI-devices.patch

subprojects/gvc/gvc-mixer-control.c

index b8198d383c389ea296ecf6abf480743fb0eb432b..6653d942014361853017682ba95afaab98fa8901 100644 (file)
@@ -1257,23 +1257,29 @@ match_stream_with_devices (GvcMixerControl    *control,
                                  stream_port->port,
                                  stream_card_id);
 
-                        if (stream_card_id == card_id &&
-                            g_strcmp0 (device_port_name, stream_port->port) == 0) {
-                                g_debug ("Match device with stream: We have a match with description: '%s', origin: '%s', cached already with device id %u, so set stream id to %i",
-                                         description,
-                                         origin,
-                                         gvc_mixer_ui_device_get_id (device),
-                                         stream_id);
-
-                                g_object_set (G_OBJECT (device),
-                                              "stream-id", stream_id,
-                                              NULL);
-                                in_possession = TRUE;
+                        if (stream_card_id == card_id) {
+                                if (g_strcmp0 (device_port_name, stream_port->port) == 0) {
+                                        g_debug ("Match device with stream: We have a match with description: '%s', origin: '%s', cached already with device id %u, so set stream id to %i",
+                                                 description,
+                                                 origin,
+                                                 gvc_mixer_ui_device_get_id (device),
+                                                 stream_id);
+
+                                        g_object_set (G_OBJECT (device),
+                                                      "stream-id", stream_id,
+                                                      NULL);
+                                        in_possession = TRUE;
+                                } else {
+                                        /* Other UI devices on that card that match the stream can't be valid */
+                                        if (device_stream_id == stream_id) {
+                                                g_object_set (G_OBJECT (device),
+                                                              "stream-id", GVC_MIXER_UI_DEVICE_INVALID,
+                                                              NULL);
+                                                g_debug ("Found another UI device for this stream: %d, resetting", stream_id);
+                                        }
+                                }
                         }
                 }
-
-                if (in_possession == TRUE)
-                        break;
         }
 
         return in_possession;